package com.zhentao.controller;

import com.zhentao.model.common.app.dto.FriendDeleteDto;
import com.zhentao.model.common.app.dto.FriendFindAllDto;
import com.zhentao.model.common.app.pojo.Friend;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.service.ApFriendService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ap/friend")
@Api(tags = "app端：加油圈")
public class ApFriendController {
    @Autowired
    private ApFriendService apFriendService;

    /**
     * app端：查询审核通过的朋友圈
     * @return
     */
    @PostMapping("/findAll")
    @ApiOperation("app端：加油圈查询")
    public ResponseResult findAll(@RequestBody FriendFindAllDto dto){
        return apFriendService.findAll(dto);
    }


    /**
     * app端：发布朋友圈
     * @param friend
     * @return
     */
    @PostMapping("/friendSave")
    @ApiOperation("发布朋友圈")
    public ResponseResult friendSave(@RequestBody Friend friend){
        return apFriendService.friendSave(friend);
    }


    /**
     * app端：删除朋友圈操作
     * @param dto
     * @return
     */
    @PostMapping("/deleteFriend")
    @ApiOperation("只能删除自己的交友圈")
    public ResponseResult deleteFriend(@RequestBody FriendDeleteDto dto){
        return apFriendService.deleteFriend(dto);
    }
}
